package com.company;

import java.util.ArrayList;
import java.util.List;

/**
 * 集装箱
 *
 * @author jianf
 * @date 2021年09月10 15:36
 */
public class Contenters {

    int min(List<Integer[]> bar){
        int num = bar.size();
        for (int i = 0; i < bar.size() -1; i++) {
            Integer[] map0 = bar.get(i);
            for (int j = i+1; j < bar.size(); j++) {
                Integer[] map1 = bar.get(j);
                if(map0[0] > map1[0]
                        && map0[1] > map1[1]
                        && map0[2] > map1[2] ||
                        map0[0] < map1[0]
                        && map0[1] < map1[1]
                        && map0[2] < map1[2]
                ){
                        num -=1;
                        break;
                }
            }
        }
        return num;
    }

    public static void main(String[] args) {
        List<Integer[]> p = new ArrayList<>();
        p.add(new Integer[]{6,6,6});
        p.add(new Integer[]{1,1,1});
        p.add(new Integer[]{2,2,2});
        p.add(new Integer[]{10,6,2});
        p.add(new Integer[]{4,3,3});
        p.add(new Integer[]{10,9,1});

        Contenters c = new Contenters();
        System.out.println("最小箱子数为： " + c.min(p));

    }
}
